Add type annotation update pre commit #122
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello @psafont and @GeraldEV!
If you believe it would be better for your review to split this PR into smaller PRs, I can do so of course!
But as the changes to the
xcp/
package itself are minimal, I think it is safe to review as is:xcp/
there is only removal of 3 unusedexcept Exception as e:
variables, which can be seen from the diff review.Background info:
I was reviewing the Python3 changes for the host-upgrade-plugin that have to be reverted because they were totally broken (the manual test didn't execute the code properly).
When running
pytype
and pyright (or just open it in an IDE like VS code which uses pyright for it's Python3 checking and type derivation) on the host-upgrade-plugin, you'll immediately see that the Python3 commit that was done was never run on Python (Python2 and not Python3) interpreter.pytype
was able to find many real bugs (some we noticed and had to revert in xen-api) in xapi-project/xen-api#5365I saw that it uses the
xcp
python-libs extensively, especially the more involved Bootloader and Accessor modules.Description of the Changes:
I saw that I had previously problems arriving at and adding the correct type comment for
xcp.acccessor.createAccessor()
.While at it, document the API of ctypes fully
xcp.acccessor.createAccessor()
in a new docstring to not have to re-collect all that information once again in the future.Some interfaces of Pylint changed with the current version of pylint, so I also needed some changes to work with.
Fix the remaining pylint warnings for unused variables and script/module names without dashes/hyphens.
Fix the CI runner scripts accordingly.
Fix the remaining unclosed file handling in a test where a StringIO was not closed in the correct order which caused a few warnings from the enabled PYTHONDEVMODE checks.
The main commit for the
xcp
is to add the type comment and the docstring:The rest are just cleanups.